home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 70 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.3 KB

  1. Path: fido.asd.sgi.com!austern
  2. From: austern (Matt Austern)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: auto_ptr again
  5. Date: 18 Jan 1996 11:00:55 PST
  6. Organization: SGI
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <AUSTERN.96Jan18103535@isolde.mti.sgi.com>
  9. References: <ADxYD_mKQD@qsar.chem.msu.su> <4djrn4$js1@engnews1.Eng.Sun.COM>
  10. Reply-To: austern@mti.mti.sgi.com
  11. NNTP-Posting-Host: isolde.mti.sgi.com
  12. X-Original-Date: 18 Jan 1996 18:35:35 GMT
  13. In-Reply-To: clamage@Eng.Sun.COM's message of 18 Jan 96 02:38:07 GMT
  14. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  15.     iQBVAwUBMP6ZAUy4NqrwXLNJAQGd9QIAgYBzVXnrAsLoepaBDAkHP/njA1KW4DpU
  16.     UjTP06pcBGNCRg38jr97ZCaIyBZlq/y4kq2gR2OztmUcCyKKtJ4Bog==
  17.     =QR35
  18. Originator: austern@isolde.mti.sgi.com
  19.  
  20. In article <4djrn4$js1@engnews1.Eng.Sun.COM> clamage@Eng.Sun.COM (Steve Clamage) writes:
  21.  
  22. > That point has been beaten to death in the C++ committee and also in
  23. > this forum. Some people felt an auto_ptr should be able to have multiple
  24. > owners, but people with experience with this kind of design persuaded
  25. > the committee that auto_ptrs are too hard to use unless they can have
  26. > only a single owner. Thus, ownership is transferred upon copying.
  27. > That is, single ownership is a deliberate design decision based on the
  28. > semantics an auto-ptr should have. It is not an implementation issue.
  29.  
  30. I thought it was generally agreed that auto_ptrs as currently defined
  31. were broken---specifically, that the semantics of strict ownership,
  32. constness, and the binding of temporary objects, ended up making an
  33. auto_ptr nearly useless for returning a value from a function.  That's
  34. unfortunate, since returning something from a function is one of the
  35. situations when it's most important to have some safe wrapper class 
  36. like auto_ptr.
  37.  
  38. I've spent a bit of time trying to come up with bright ideas for
  39. fixing auto_ptr, but I don't really have any.  Reference-counted
  40. pointers don't have this particular problem, though, and that might be
  41. the best argument for putting rc_ptr in the standard in addition to
  42. (or instead of) auto_ptr.
  43. -- 
  44. Matt Austern
  45. SGI: MTI Compilers Group
  46. austern@isolde.mti.sgi.com
  47. ---
  48. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  49.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  50.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  51.